/*
 * Copyright (C) 2018 Tom Li <tomli at tomli.me>.
 *
 * This software is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 3, or (at your option) any
 * later version.
 *
 * This software is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * See COPYING for terms and conditions.
 *
 * GPL or LGPL does __not__ require attribution beyond preserving and
 * following the license, but if you find my code is useful or inspirational
 * to your own project, I'd be thankful if you attribute my name.
 */

#define USED_IN_ASM(x) (x)

#define CPUCLK_NORMAL (0)
#define CPUCLK_FULL   (3)

#define FINDSYM_APPVAR (0x15)

uint16_t bank1_get(void);
void bank1_swap(const uint16_t page) __z88dk_fastcall __naked;
void bank1_fastswap(const uint8_t page) __z88dk_fastcall __naked;
uint8_t cpuclk_get(void);
void cpuclk_set(const uint8_t speed);

void clear_screen(void);
void getkey(void);
void disphl(uint8_t, uint8_t, const uint16_t);
void fillrect(uint16_t x1, uint16_t x2, uint8_t y1, uint8_t y2);
const bool findsym(const uint8_t, const unsigned char *, uint16_t *, uint16_t *);
const bool findapp(const unsigned char *name, uint16_t *page, uint16_t *addr);

void lcd_halfres(void);
void lcd_fullres(void);

/* DCSE routines */
void clear_lcd(void);
void drawsprite_1bit(uint16_t x, uint16_t y, uint8_t *palatte, uint8_t *sprite);
void drawsprite_8bit(uint16_t x, uint16_t y, uint8_t *palette, uint8_t *sprite);

__at(0x4000) static uint8_t bank1[16384];

__at(0x8459) static uint8_t cursor_row;
__at(0x845A) static uint8_t cursor_col;
